const state = {
    picbookList: [],
    picbookIndex: {},
    picbookType: "乐学园",
    listPage: 0,
    recommendPage: 0,
    vipPicbookList: [],  //vip的限定绘本
}
const getters = {
    //获取绘本列表
    getPicbookList(state) {
        return state.picbookList
    },
    //获取点击的绘本
    getPicbookIndex(state) {
        return state.picbookIndex
    },
    //获取绘本分类
    getPicbookType(state) {
        return state.picbookType
    },
    //获取全部绘本列表当前页
    getListPage(state) {
        return state.listPage
    },
    //获取推荐列表当前页
    getRecommendPage(state) {
        return state.recommendPage
    },
    //获取vip限定的绘本
    getVipPicbookList(state){
        return state.vipPicbookList
    },
};
const mutations = {
    //初始化绘本列表
    setPicbookList(state, param) {
        state.picbookList = param
    },
    //修改当前点击绘本
    setPicbookIndex(state, param) {
        state.picbookIndex = param
    },
    //修改绘本分类
    setPicbookType(state, param) {
        state.picbookType = param
    },
    //修改全部绘本列表当前页
    setListPage(state, param) {
        state.listPage = param
    },
    //修改推荐绘本列表当前页
    setRecommendPage(state, param) {
        state.recommendPage = param
    },
    //修改vip限定绘本
    setVipPicbookList(state, param){
        state.vipPicbookList = param
    },
};
const actions = {
    setPicbookList({
        commit
    }, param) {
        commit('setPicbookList', param);
    },
    setPicbookIndex({
        commit
    }, param) {
        commit("setPicbookIndex", param)
    },
    setPicbookType({ commit }, param) {
        commit("setPicbookType", param)
    },
    setListPage({ commit }, param) {
        commit('setListPage', param)
    },
    setRecommendPage({ commit }, param) {
        commit("setRecommendPage", param)
    },
    setVipPicbookList({ commit }, param) {
        commit("setVipPicbookList", param)
    },
};
export default {
    namespaced: true, //用于在全局引用此文件里的方法时标识这一个的文件名
    state,
    getters,
    mutations,
    actions
}
